package com.niiwoo.civet.mobile.vo.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@ApiModel("用户安全中心")
public class UserSecurityResponseVO {

    @ApiModelProperty(value = "用户是否开通存管(true:开通，false:未开能)")
    private boolean isOpenAccount;

    @ApiModelProperty(value = "存管账号")
    private BankAccount bankAccount;

    @ApiModelProperty(value = "登录密码设置(暂时没用到)")
    private String isSetLoginPassword;

    @ApiModelProperty(value = "是否开启免密投资（true：开启，false：未开启")
    private boolean isDirectInvest;

    @ApiModelProperty(value = "用户银行卡")
    private BankCard bankCard;

    @ApiModelProperty(value = "用户风险评测")
    private RiskAssessment riskAssessment;

    @ApiModelProperty(value = "银行预留联系人")
    private BankLinkman bankLinkman;

    @ApiModelProperty(value = "企业信息")
    private String companyInfo;

    @Setter
    @Getter
    @ApiModel("存管账号")
    public class BankAccount{
        @ApiModelProperty(value = "公司名称")
        private String companyName;
        @ApiModelProperty(value = "统一社会信用代码")
        private String creditCode;
        @ApiModelProperty(value = "存管账号审核状态（普通用户默认审核通过） 审核状态 0.初始化 1审核中 2审核通过 3.审核失败 4.审核退回")
        private Byte status;

        public void setCompanyName(String companyName){
            if(companyName.length() > 4){
                String startName = companyName.substring(0,2);
                String endName = companyName.substring(companyName.length()-2,companyName.length());
                this.companyName = startName + "***" + endName;
            }
        }

        public void setCreditCode(String creditCode){
            String startCode = creditCode.substring(0,4);
            String endCode = creditCode.substring(creditCode.length()-4,creditCode.length());
            this.creditCode = startCode+"***"+endCode;
        }
    }

    @Setter
    @Getter
    @ApiModel("银行卡")
    public class BankCard{
        @ApiModelProperty(value = "银行名称")
        private String bankName;
        @ApiModelProperty(value = "银行卡号，尾号XXXX")
        private String bankCardTailNumber;

        public void setBankCardTailNumber(String bankCardTailNumber){
            if(null != bankCardTailNumber && !"".equals(bankCardTailNumber)){
                this.bankCardTailNumber = "尾号" + bankCardTailNumber.substring(bankCardTailNumber.length()-4,bankCardTailNumber.length());
            }
        }
    }

    @Setter
    @Getter
    @ApiModel("风险评测")
    public class RiskAssessment{
        @ApiModelProperty(value = "风险评测剩余次数")
        private Integer residueDegree;
        @ApiModelProperty(value = "风险评测结果 1-保守型，2-稳健型，3-积极型")
        private Byte riskAssessmentResult;

        public void setResidueDegree(Integer residueDegree){
            this.residueDegree = 3 - residueDegree ;
        }

    }

    @Setter
    @Getter
    @ApiModel("银行预留联系人")
    public class BankLinkman{
        @ApiModelProperty(value = "银行预留联系人姓名")
        private String linkmanName;
        @ApiModelProperty(value = "银行预留联系人手机号")
        private String linkmanMobile;

        public void setLinkmanName(String linkmanName) {
            if( null != linkmanName && !"".equals(linkmanName)) {
                this.linkmanName = linkmanName.substring(0,1) + "**";
            }
        }

        public void setLinkmanMobile(String linkmanMobile) {
            if( null != linkmanMobile && !"".equals(linkmanMobile)) {
                this.linkmanMobile = linkmanMobile.substring(0, 3) + "****" + linkmanMobile.substring(linkmanMobile.length() - 4, linkmanMobile.length());
            }
        }

    }

}
